package ca.etsmtl.gti785.servlet;

import ca.etsmtl.gti785.util.Fichier;
import com.google.gson.Gson;

/**
 * This class is used for the FileTransfer between the client side and the server side. It contains the server destination url and the file/folder to transfer.
 * @author Étienne Faucher
 */
public class FileTransferJson 
{
	private static Gson _gson = new Gson();
	public String url;
	public final Fichier fileServer;
	
	public FileTransferJson(String url, Fichier fileServer)
	{
		this.url = url;
		this.fileServer = fileServer;
	}
	
	public String toJson()
	{
		return _gson.toJson(this);
	}
	
	public static FileTransferJson fromJson(String json)
	{
		return _gson.fromJson(json, FileTransferJson.class);
	}
}
